<?php

declare(strict_types=1);

namespace App\Command;

use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command;
use Symfony\Component\Console\Input\InputArgument;
use Psr\Container\ContainerInterface;
use Hyperf\Di\Annotation\Inject;

use App\Service\TestService;
use App\Utils\CustomUtils;
/**
 * @Command
 */
class TestCommand extends HyperfCommand
{
    /**
     * @var ContainerInterface
     */
    protected $container;

    // public function __construct(ContainerInterface $container)
    // {
    //     $this->container = $container;

    //     parent::__construct('demo:command');
    // }



    /**
     * 执行的命令行
     *
     * @var string
     */
    protected $name = 'test:List';
    protected $signature = 'test:List {--name= : user_name} {--xxxx= : xxxx}';

    /**
     * @Inject()
     * @var TestService
     */
    private $TestService;

    public function configure()
    {
        parent::configure();
        $this->setDescription('Hyperf Demo Command');
        // $this->addArgument('name', InputArgument::OPTIONAL, '姓名', 'Hyperf');
    }

    public function handle()
    {
        // $this->line($this->input->getArgument('name'));
        $this->line('Hello Hyperf!', 'info');
        CustomUtils::xzxDebug("enter List command");
        var_dump($this->input->getArguments());
        var_dump("=====================");
        var_dump($this->input->getOption('name'));
        var_dump($this->input->getOption('xxxx'));
        // $param = array();
        // $param['page'] = 1;
        // $param['limit'] = 1;
        // $this->TestService->list($param);
    }
}
